﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EmotionRecognitionEntities;

namespace EmotionRecognitionManager
{
    public static class Statistics
    {

        //will be filled from each user

        static int basicRetrieval = 0;

        static int  basicAdaptation=0;//

        static int secondRoundIndexRetrieval = 0;

        static int secondRoundIndexAdaptation = 0;

        static int afterRefinementRetrieval = 0;

        static int aftetRefinementAdaptation = 0;


          public static ReplyMsg GetretrievalCorrectAnswer()
          {

              return new ReplyMsg(true, basicRetrieval, basicAdaptation, secondRoundIndexRetrieval, secondRoundIndexAdaptation, afterRefinementRetrieval, aftetRefinementAdaptation);
          }


          public static ReplyMsg UpdateStatisticsManager(StatisticsType statisticsType,FeedBackType feedbackType )

          {
              switch (statisticsType)
              {

                  case(StatisticsType.Basic):
                      {
                         UpdateVariables( ref basicRetrieval, ref basicAdaptation,feedbackType);
                         return new ReplyMsg(true);
                      }

                  case(StatisticsType.SecondIndex):
                       {
                         UpdateVariables(ref secondRoundIndexRetrieval, ref secondRoundIndexAdaptation, feedbackType);
                         return new ReplyMsg(true);
                       }

                  case(StatisticsType.Refinement):
                        {
                         UpdateVariables(ref afterRefinementRetrieval, ref aftetRefinementAdaptation, feedbackType);
                         return new ReplyMsg(true);

                        }

                  default: return new ReplyMsg(false);

              }


           


              
          }

          public static void UpdateVariables( ref int retreival, ref int adaptation,FeedBackType feedbackType)
          {

              if (feedbackType==FeedBackType.Accept)
                  retreival++;
               else 
                  adaptation++;
          }

          public static ReplyMsg ResetVariables(StatisticsType statisticsType)
          {
              switch (statisticsType)
              {
                  case StatisticsType.Basic:
                      {
                          basicRetrieval = 0;
                          basicAdaptation = 0;
                          return new ReplyMsg(true);
                      }

                  case StatisticsType.SecondIndex:
                      {
                          secondRoundIndexRetrieval = 0;
                          secondRoundIndexAdaptation = 0;
                          return new ReplyMsg(true);

                      }
                  case StatisticsType.Refinement:
                      {
                          afterRefinementRetrieval = 0;
                          aftetRefinementAdaptation = 0;
                          return new ReplyMsg(true);
                      }

                  default: return new ReplyMsg(false);

              }

          }

          
    }
}
